Implement UseUserAccessGroup for Firebase Auth C++ SDK#1754
Closed
jonsimantov wants to merge 2 commits intomainfrom
Closed
Implement UseUserAccessGroup for Firebase Auth C++ SDK#1754jonsimantov wants to merge 2 commits intomainfrom
jonsimantov wants to merge 2 commits intomainfrom
Conversation
This commit introduces the `UseUserAccessGroup` method to the Firebase Authentication C++ SDK. This method allows developers to specify a user access group for iCloud keychain access on iOS. It calls the underlying Objective-C method `[FIRAuth useUserAccessGroup:error:]`. On other platforms (Desktop, Android), this method is a no-op and returns `kAuthErrorNone` as the feature is iOS-specific. Key changes: - Added `UseUserAccessGroup` declaration to `firebase::auth::Auth` in `auth/src/include/firebase/auth.h` with Doxygen comments. - Implemented the iOS-specific logic in `auth/src/ios/auth_ios.mm`, including error handling and string conversion. - Added a stub implementation in `auth/src/desktop/auth_desktop.cc` for non-iOS platforms.
jonsimantov
commented
Jun 27, 2025
| auth_impl->assigned_emulator_url.append(std::to_string(port)); | ||
| } | ||
|
|
||
| AuthError Auth::UseUserAccessGroup(const char* access_group) { |
Contributor
Author
There was a problem hiding this comment.
Android also needs this stub.
jonsimantov
commented
Jun 27, 2025
| return kAuthErrorUninitialized; | ||
| } | ||
| NSString* access_group_ns_str = nil; | ||
| if (access_group_str != nullptr && strlen(access_group_str) > 0) { |
Contributor
Author
There was a problem hiding this comment.
If there is a blank string, let's pass it in verbatim instead of nil. Remember to update the docs to reflect this.
jonsimantov
commented
Jun 27, 2025
| if (success) { | ||
| return kAuthErrorNone; | ||
| } else { | ||
| return AuthErrorFromNSError(error); |
Contributor
Author
There was a problem hiding this comment.
Can you double-check which error codes this might return and make sure there are values for all of them in the AuthError enum and the AuthErrorFromNSError function?
This commit addresses feedback from the pull request review for the UseUserAccessGroup feature: - Added a stub implementation for Android in `auth_android.cc`. - Updated iOS implementation in `auth_ios.mm` to pass an empty NSString (`@""`) to the native SDK if an empty C++ string is provided. `nullptr` still results in `nil` being passed. - Updated Doxygen comments in `auth.h` to reflect the iOS behavior for `nullptr` and empty string inputs more accurately. - Investigated potential NSError codes for the underlying iOS SDK method. Confirmed that `FIRAuthErrorCodeKeychainError` is the most relevant documented error, and it is already correctly handled by the existing C++ error mapping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces the
UseUserAccessGroupmethod to the Firebase Authentication C++ SDK.This method allows developers to specify a user access group for iCloud keychain access on iOS. It calls the underlying Objective-C method
[FIRAuth useUserAccessGroup:error:].On other platforms (Desktop, Android), this method is a no-op and returns
kAuthErrorNoneas the feature is iOS-specific.Key changes:
UseUserAccessGroupdeclaration tofirebase::auth::Authinauth/src/include/firebase/auth.hwith Doxygen comments.auth/src/ios/auth_ios.mm, including error handling and string conversion.auth/src/desktop/auth_desktop.ccfor non-iOS platforms.Description
Testing
Type of Change
Place an
xthe applicable box:Notes
Release Notessection ofrelease_build_files/readme.md.